﻿using System;

using Job.Core.Module;
using Job.Core.Data;
using Job.Core.Security.Permissions;

namespace Job.Core.Service
{
    /// <summary>
    ///  服务类。
    /// </summary>
    public static class IService<TModuleName, TModel>
        where TModel : IInterface<TModel>, new()
        where TModuleName : IComparable

    {

        #region Properties


        /// <summary>
        /// 模块名称。
        /// </summary>
        public TModuleName ModuleName { get; set; }

        public static IComparable IDichotomyNode.Id
        {
            get { return ModuleName; }
        }


        //private const string moduleName = "Article";
        ///// <summary>
        ///// 模块名称。
        ///// </summary>
        //public static string ModuleName
        //{
        //    get { return moduleName; }
        //}

        private static readonly TModel repository = ProviderService.GetModule(ModuleName) as TModel;

        /// <summary>
        /// 仓储。
        /// </summary>
        public static TModel Repository
        {
            get { return repository; }
        }

        #endregion

    }
}
